/*
 * Copyright (c) 2025 CAX Conversion Project
 */
package com.comac.ins.isfd.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.comac.ins.common.core.domain.R;
import com.comac.ins.common.core.validate.AddGroup;
import com.comac.ins.common.core.validate.EditGroup;
import com.comac.ins.common.excel.utils.ExcelUtil;
import com.comac.ins.common.idempotent.annotation.RepeatSubmit;
import com.comac.ins.common.log.annotation.Log;
import com.comac.ins.common.log.enums.BusinessType;
import com.comac.ins.common.mybatis.core.page.PageQuery;
import com.comac.ins.common.mybatis.core.page.TableDataInfo;
import com.comac.ins.common.web.core.BaseController;
import com.comac.ins.isfd.domain.bo.IsfdModelManagementRenderingBo;
import com.comac.ins.isfd.domain.bo.query.IsfdModelManagementRenderingQueryBo;
import com.comac.ins.isfd.domain.vo.IsfdModelManagementRenderingResultVo;
import com.comac.ins.isfd.domain.vo.IsfdModelManagementRenderingVo;
import com.comac.ins.isfd.service.IIsfdModelManagementRenderingService;
import com.comac.ins.isfd.service.IIsfdModelManagementRenderingTaskService;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 模型零件渲染
 *
 * @author Lion Li
 * @date 2024-08-30
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/isfd/modelManagementRendering")
public class IsfdModelManagementRenderingController extends BaseController {

    private final IIsfdModelManagementRenderingService isfdModelManagementRenderingService;
    private final IIsfdModelManagementRenderingTaskService isfdModelManagementRenderingTaskService;

    /**
     * 加载模型零件渲染
     */
    @SaCheckPermission("isfd:modelManagementRendering:load")
    @Log(title = "模型零件渲染", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping("/load")
    public R<IsfdModelManagementRenderingResultVo> load(@Validated(AddGroup.class) @RequestBody IsfdModelManagementRenderingQueryBo bo) {
        return R.ok(isfdModelManagementRenderingService.load(bo));
    }

    /**
     * 加载任务组件渲染
     */
    @SaCheckPermission("isfd:modelManagementRendering:loadTask")
    @Log(title = "模型零件渲染", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping("/loadTask")
    public R<IsfdModelManagementRenderingResultVo> loadTask(@Validated(AddGroup.class) @RequestBody IsfdModelManagementRenderingQueryBo bo) {
        return R.ok(isfdModelManagementRenderingTaskService.loadTask(bo));
    }

}
